<a><img src="<?= base_url() ?>img/logoijf.gif" width="200" height="20" alt="teste"></a>
<br>
<br>
    <h3><center>FOLHA DE INSS REFERENTE A GIAAH <?php echo substr($competenciaativa, 4, 2) . "/" . substr($competenciaativa, 0, 4); ?></center></h3>
    <table border="1" >
        <thead>
            <tr>
                <tr bgcolor ="gray">
                <th>Matr&iacute;cula</th>
                <th>Nome</th>
                <th>Funcao</th>
                <th>INSS</th>
                <th>Base Calc</th>
                <th>INSS EMP.</th>
            </tr>

            <?php
            $total = 0;
            $total2 = 0;
            $total3 = 0;
            foreach ($lista as $item) {
            ?>
                <tr>
                    <td><?php echo $item->matricula; ?></td>
                    <td><?php echo $item->nome; ?></td>
                    <td><?php echo utf8_decode($item->funcao); ?></td>
                    <td>R$ <?php echo number_format($item->inss, 2, ",", "."); ?></td>
                    <td>R$ <?php echo number_format($item->valor, 2, ",", "."); ?></td>
                </tr>

            <?php
            $total = $total + $item->inss;
            $total2 = $total2 + $item->valor;
            $total3 = $total2 * (21/100);
            }
            ?>
            <tr>
                <tr bgcolor ="gray">
                <td colspan="3">TOTAL</td>
                <td>R$ <?php echo number_format($total, 2, ",", "."); ?></td>
                <td>R$ <?php echo number_format($total2, 2, ",", "."); ?></td>
                <td>R$ <?php echo number_format($total3, 2, ",", "."); ?></td>
            </tr>
    </table>
